﻿module lang.d.sts.declarations.dfunctiondeclaration;

import lang.d.sts.declarations.ddeclaration;
import lang.d.sts.statements.dblockstatement;
import lang.d.visitors.dvisitor;

class DFunctionDeclaration: DDeclaration {
    private DBlockStatement myBody;
    private DBlockStatement myPreConditions;
    private DBlockStatement myPostConditions;
    private string myOutIdentifier;
    private string myName;

    public this(uint attribute) {
        super(attribute);
    }

    public void setPreConditions(DBlockStatement stat) {
        myPreConditions = stat;
        myPreConditions.setParent(this);
    }

    public DBlockStatement getPreConditions() {
        return myPreConditions;
    }
    
    public void setPostConditions(DBlockStatement stat) {
        myPostConditions = stat;
        myPostConditions.setParent(this);
    }

    public void setOutIdentifier(in string identifier) {
        myOutIdentifier = identifier;
    }

    public DBlockStatement getPostConditions() {
        return myPostConditions;
    }
    
    public void setBody(DBlockStatement stat) {
        myBody = stat;
        myBody.setParent(this);
    }

    public DBlockStatement getBody() {
        return myBody;
    }

    public void setName(in string name) {
        myName = name;
    }

    override void accept(DVisitor visitor) {
        visitor.visitFunctionDeclaration(this);
    }
}